home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / EnterCD 06_2004.iso / Internet / Bloomba 1.0.6 / Bloomba1706Installer.exe / saproxy / Disk1 / data1.cab / rules / 20_html_tests.cf < prev    next >
Encoding:
Text File  |  2004-03-01  |  13.2 KB  |  291 lines

  1. # SpamAssassin rules file: HTML tests
  2. #
  3. # Please don't modify this file as your changes will be overwritten with
  4. # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
  5. # See 'perldoc Mail::SpamAssassin::Conf' for details.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of either the Artistic License or the GNU General
  9. # Public License as published by the Free Software Foundation; either
  10. # version 1 of the License, or (at your option) any later version.
  11. #
  12. # See the file "License" in the top level of the SpamAssassin source
  13. # distribution for more details.
  14. #
  15. ###########################################################################
  16.  
  17. require_version @@VERSION@@
  18.  
  19. # HTML parser tests
  20. #
  21. # please sort these by eval type then name
  22.  
  23. # HTML control test, HTML spam rules should all have better S/O than this
  24. body HTML_MESSAGE        eval:html_message()
  25. describe HTML_MESSAGE        HTML included in message
  26.  
  27. # the HTML percentage range
  28. # should really be converted into a numeric function test
  29. body HTML_00_10            eval:html_range('ratio','0.00','0.10')
  30. body HTML_10_20            eval:html_range('ratio','0.10','0.20')
  31. body HTML_20_30            eval:html_range('ratio','0.20','0.30')
  32. body HTML_30_40            eval:html_range('ratio','0.30','0.40')
  33. body HTML_40_50            eval:html_range('ratio','0.40','0.50')
  34. body HTML_50_60            eval:html_range('ratio','0.50','0.60')
  35. body HTML_60_70            eval:html_range('ratio','0.60','0.70')
  36. body HTML_70_80            eval:html_range('ratio','0.70','0.80')
  37. body HTML_80_90            eval:html_range('ratio','0.80','0.90')
  38. body HTML_90_100        eval:html_range('ratio','0.90','1.00')
  39. describe HTML_00_10        Message is 0% to 10% HTML
  40. describe HTML_10_20        Message is 10% to 20% HTML
  41. describe HTML_20_30        Message is 20% to 30% HTML
  42. describe HTML_30_40        Message is 30% to 40% HTML
  43. describe HTML_40_50        Message is 40% to 50% HTML
  44. describe HTML_50_60        Message is 50% to 60% HTML
  45. describe HTML_60_70        Message is 60% to 70% HTML
  46. describe HTML_70_80        Message is 70% to 80% HTML
  47. describe HTML_80_90        Message is 80% to 90% HTML
  48. describe HTML_90_100        Message is 90% to 100% HTML
  49.  
  50. # HTML shouting range
  51. # should really be converted into a numeric function test
  52. body HTML_SHOUTING3        eval:html_range('max_shouting','2','3')
  53. body HTML_SHOUTING4        eval:html_range('max_shouting','3','4')
  54. body HTML_SHOUTING5        eval:html_range('max_shouting','4','5')
  55. body HTML_SHOUTING6        eval:html_range('max_shouting','5','6')
  56. body HTML_SHOUTING7        eval:html_range('max_shouting','6','7')
  57. body HTML_SHOUTING8        eval:html_range('max_shouting','7','8')
  58. body HTML_SHOUTING9        eval:html_range('max_shouting','8')
  59. describe HTML_SHOUTING3        HTML has very strong "shouting" markup
  60. describe HTML_SHOUTING4        HTML has very strong "shouting" markup
  61. describe HTML_SHOUTING5        HTML has very strong "shouting" markup
  62. describe HTML_SHOUTING6        HTML has very strong "shouting" markup
  63. describe HTML_SHOUTING7        HTML has very strong "shouting" markup
  64. describe HTML_SHOUTING8        HTML has very strong "shouting" markup
  65. describe HTML_SHOUTING9        HTML has very strong "shouting" markup
  66.  
  67. body HTML_TABLE_THICK_BORD        eval:html_test('thick_border')
  68. describe HTML_TABLE_THICK_BORD    HTML table has thick border
  69.  
  70. body HTML_COMMENT_EMAIL        eval:html_test('comment_email')
  71. describe HTML_COMMENT_EMAIL    HTML comment contains email address
  72.  
  73. body HTML_COMMENT_SHOUTING    eval:html_test('comment_shouting')
  74. describe HTML_COMMENT_SHOUTING    HTML comment inside of "shouting" markup
  75.  
  76. body HTML_COMMENT_SKY        eval:html_test('comment_sky')
  77. describe HTML_COMMENT_SKY    HTML comment contains SKY database codes
  78.  
  79. body HTML_COMMENT_8BITS        eval:html_test('comment_8bit')
  80. describe HTML_COMMENT_8BITS    HTML comment has 3 consecutive 8-bit chars
  81.  
  82. body HTML_COMMENT_SAVED_URL    eval:html_test('comment_saved_url')
  83. describe HTML_COMMENT_SAVED_URL    HTML message is a saved web page
  84.  
  85. body HTML_EMBEDS        eval:html_test('embeds')
  86. describe HTML_EMBEDS        HTML with embedded plugin object
  87.  
  88. body HTML_EVENT            eval:html_test('html_event')
  89. describe HTML_EVENT        HTML contains auto-executing code
  90.  
  91. body HTML_EVENT_UNSAFE        eval:html_test('html_event_unsafe')
  92. describe HTML_EVENT_UNSAFE    HTML contains unsafe auto-executing code
  93.  
  94. body HTML_FONT_BIG        eval:html_test('big_font')
  95. describe HTML_FONT_BIG        HTML has a big font
  96.  
  97. body HTML_FONTCOLOR_UNSAFE    eval:html_test('font_color_unsafe')
  98. describe HTML_FONTCOLOR_UNSAFE    HTML font color not in safe 6x6x6 palette
  99.  
  100. body HTML_FONTCOLOR_NAME    eval:html_test('font_color_name')
  101. describe HTML_FONTCOLOR_NAME    HTML font color has unusual name
  102.  
  103. body HTML_FONT_INVISIBLE    eval:html_test('font_invisible')
  104. describe HTML_FONT_INVISIBLE    HTML font color is same as background
  105.  
  106. body HTML_FONT_LOW_CONTRAST    eval:html_test('font_near_invisible')
  107. describe HTML_FONT_LOW_CONTRAST    HTML font color similar to background
  108.  
  109. body HTML_FONTCOLOR_GRAY    eval:html_test('font_gray')
  110. describe HTML_FONTCOLOR_GRAY    HTML font color is gray
  111.  
  112. body HTML_FONTCOLOR_RED    eval:html_test('font_red')
  113. describe HTML_FONTCOLOR_RED    HTML font color is red
  114.  
  115. body HTML_FONTCOLOR_YELLOW    eval:html_test('font_yellow')
  116. describe HTML_FONTCOLOR_YELLOW    HTML font color is yellow
  117.  
  118. body HTML_FONTCOLOR_GREEN    eval:html_test('font_green')
  119. describe HTML_FONTCOLOR_GREEN    HTML font color is green
  120.  
  121. body HTML_FONTCOLOR_CYAN    eval:html_test('font_cyan')
  122. describe HTML_FONTCOLOR_CYAN    HTML font color is cyan
  123.  
  124. body HTML_FONTCOLOR_BLUE    eval:html_test('font_blue')
  125. describe HTML_FONTCOLOR_BLUE    HTML font color is blue
  126.  
  127. body HTML_FONTCOLOR_MAGENTA        eval:html_test('font_magenta')
  128. describe HTML_FONTCOLOR_MAGENTA    HTML font color is magenta
  129.  
  130. body HTML_FONTCOLOR_UNKNOWN        eval:html_test('font_color_unknown')
  131. describe HTML_FONTCOLOR_UNKNOWN    HTML font color is unknown to us
  132.  
  133. body HTML_FONT_FACE_BAD        eval:html_test('font_face_bad')
  134. describe HTML_FONT_FACE_BAD    HTML font face is not a word
  135.  
  136. body HTML_FONT_FACE_ODD        eval:html_test('font_face_odd')
  137. describe HTML_FONT_FACE_ODD    HTML font face is not a commonly used face
  138.  
  139. body HTML_FONT_FACE_CAPS    eval:html_test('font_face_caps')
  140. describe HTML_FONT_FACE_CAPS    HTML font face has excess capital characters
  141.  
  142. body HTML_FORMACTION_MAILTO        eval:html_test('form_action_mailto')
  143. describe HTML_FORMACTION_MAILTO    HTML includes a form which sends mail
  144.  
  145. # HTML_IMAGE_AREA - lots of image area (absolute)
  146. # note that: 640x480 = 307200, 800x600 = 480000, 1024x768=786432
  147. body HTML_IMAGE_AREA_04        eval:html_range('image_area','400000','500000')
  148. body HTML_IMAGE_AREA_05        eval:html_range('image_area','500000','600000')
  149. body HTML_IMAGE_AREA_06        eval:html_range('image_area','600000','700000')
  150. body HTML_IMAGE_AREA_07        eval:html_range('image_area','700000','800000')
  151. body HTML_IMAGE_AREA_08        eval:html_range('image_area','800000','900000')
  152. body HTML_IMAGE_AREA_09        eval:html_range('image_area','900000')
  153. describe HTML_IMAGE_AREA_04    HTML has 4-5 kilopixels of images
  154. describe HTML_IMAGE_AREA_05    HTML has 5-6 kilopixels of images
  155. describe HTML_IMAGE_AREA_06    HTML has 6-7 kilopixels of images
  156. describe HTML_IMAGE_AREA_07    HTML has 7-8 kilopixels of images
  157. describe HTML_IMAGE_AREA_08    HTML has 8-9 kilopixels of images
  158. describe HTML_IMAGE_AREA_09    HTML has over 9 kilopixels of images
  159.  
  160. # HTML_IMAGE_ONLY - not much text with images (absolute)
  161. body HTML_IMAGE_ONLY_02        eval:html_image_only('0000','0200')
  162. body HTML_IMAGE_ONLY_04        eval:html_image_only('0200','0400')
  163. body HTML_IMAGE_ONLY_06        eval:html_image_only('0400','0600')
  164. body HTML_IMAGE_ONLY_08        eval:html_image_only('0600','0800')
  165. body HTML_IMAGE_ONLY_10        eval:html_image_only('0800','1000')
  166. body HTML_IMAGE_ONLY_12        eval:html_image_only('1000','1200')
  167. describe HTML_IMAGE_ONLY_02    HTML: images with 0-200 bytes of words
  168. describe HTML_IMAGE_ONLY_04    HTML: images with 200-400 bytes of words
  169. describe HTML_IMAGE_ONLY_06    HTML: images with 400-600 bytes of words
  170. describe HTML_IMAGE_ONLY_08    HTML: images with 600-800 bytes of words
  171. describe HTML_IMAGE_ONLY_10    HTML: images with 800-1000 bytes of words
  172. describe HTML_IMAGE_ONLY_12    HTML: images with 1000-1200 bytes of words
  173.  
  174. # HTML_IMAGE_RATIO - more image area than text (ratio)
  175. body HTML_IMAGE_RATIO_02    eval:html_image_ratio('0.000','0.002')
  176. body HTML_IMAGE_RATIO_04    eval:html_image_ratio('0.002','0.004')
  177. body HTML_IMAGE_RATIO_06    eval:html_image_ratio('0.004','0.006')
  178. body HTML_IMAGE_RATIO_08    eval:html_image_ratio('0.006','0.008')
  179. body HTML_IMAGE_RATIO_10    eval:html_image_ratio('0.008','0.010')
  180. body HTML_IMAGE_RATIO_12    eval:html_image_ratio('0.010','0.012')
  181. body HTML_IMAGE_RATIO_14    eval:html_image_ratio('0.012','0.014')
  182. describe HTML_IMAGE_RATIO_02    HTML has a low ratio of text to image area
  183. describe HTML_IMAGE_RATIO_04    HTML has a low ratio of text to image area
  184. describe HTML_IMAGE_RATIO_06    HTML has a low ratio of text to image area
  185. describe HTML_IMAGE_RATIO_08    HTML has a low ratio of text to image area
  186. describe HTML_IMAGE_RATIO_10    HTML has a low ratio of text to image area
  187. describe HTML_IMAGE_RATIO_12    HTML has a low ratio of text to image area
  188. describe HTML_IMAGE_RATIO_14    HTML has a low ratio of text to image area
  189.  
  190. body HTML_JAVASCRIPT        eval:html_test('javascript')
  191. describe HTML_JAVASCRIPT    JavaScript code
  192.  
  193. body HTML_LINK_PUSH_HERE    eval:html_eval('anchor_text', '=~ /(?:push|go)\s*(?:here|this)/i')
  194. describe HTML_LINK_PUSH_HERE    HTML link text says "push here" or similar
  195.  
  196. body HTML_LINK_CLICK_HERE    eval:html_eval('anchor_text', '=~ /click\s*(?:here|this)/i')
  197. describe HTML_LINK_CLICK_HERE    HTML link text says "click here"
  198.  
  199. body HTML_LINK_CLICK_CAPS    eval:html_eval('anchor_text', '=~ /CLICK/')
  200. describe HTML_LINK_CLICK_CAPS    HTML link text says "CLICK"
  201.  
  202. # many spammers seem to do this nowadays (and probably track
  203. # their customers with it).  (contrib: WW)
  204. body HTML_RELAYING_FRAME    eval:html_test('relaying_frame')
  205. describe HTML_RELAYING_FRAME    Frame wanted to load outside URL
  206.  
  207. body HTML_WEB_BUGS        eval:html_test('web_bugs')
  208. describe HTML_WEB_BUGS        Image tag intended to identify you
  209.  
  210. body HTML_WIN_BLUR        eval:html_test('window_blur')
  211. describe HTML_WIN_BLUR        Javascript to move windows around
  212.  
  213. body HTML_WIN_FOCUS        eval:html_test('window_focus')
  214. describe HTML_WIN_FOCUS        Javascript to change window focus
  215.  
  216. body HTML_WIN_OPEN        eval:html_test('window_open')
  217. describe HTML_WIN_OPEN        Javascript to open a new window
  218.  
  219. body HTML_WITH_BGCOLOR        eval:html_test('bgcolor_nonwhite')
  220. describe HTML_WITH_BGCOLOR    HTML mail with non-white background
  221.  
  222. body HTML_TAG_BALANCE_A        eval:html_tag_balance('a', '< 0')
  223. describe HTML_TAG_BALANCE_A    HTML has excess "a" close tags
  224.  
  225. body HTML_TAG_BALANCE_FONT    eval:html_tag_balance('font', '< 0')
  226. describe HTML_TAG_BALANCE_FONT    HTML has excess "font" close tags
  227.  
  228. body HTML_TAG_BALANCE_HTML    eval:html_tag_balance('html', '!= 0')
  229. describe HTML_TAG_BALANCE_HTML    HTML has unbalanced "html" tags
  230.  
  231. body HTML_TAG_BALANCE_BODY    eval:html_tag_balance('body', '!= 0')
  232. describe HTML_TAG_BALANCE_BODY    HTML has unbalanced "body" tags
  233.  
  234. body HTML_TAG_BALANCE_HEAD    eval:html_tag_balance('head', '!= 0')
  235. describe HTML_TAG_BALANCE_HEAD    HTML has unbalanced "head" tags
  236.  
  237. body HTML_TAG_BALANCE_TABLE    eval:html_tag_balance('table', '> 0')
  238. describe HTML_TAG_BALANCE_TABLE    HTML is missing "table" close tags
  239.  
  240. body HTML_TAG_EXISTS_BASE    eval:html_tag_exists('base')
  241. describe HTML_TAG_EXISTS_BASE    HTML has "base" tags
  242.  
  243. body HTML_TAG_EXISTS_PARAM    eval:html_tag_exists('param')
  244. describe HTML_TAG_EXISTS_PARAM    HTML has "param" tag
  245.  
  246. body HTML_TAG_EXISTS_TBODY    eval:html_tag_exists('tbody')
  247. describe HTML_TAG_EXISTS_TBODY    HTML has "tbody" tag
  248.  
  249. body HTML_TITLE_EMPTY        eval:html_eval('title_text', '!~ /\S/s')
  250. describe HTML_TITLE_EMPTY    HTML title contains no text
  251.  
  252. body HTML_TITLE_UNTITLED    eval:html_eval('title_text', '=~ /Untitled/i')
  253. describe HTML_TITLE_UNTITLED    HTML title contains "Untitled"
  254.  
  255. ###########################################################################
  256. # meta tests
  257.  
  258. body __HTML_CHARSET_FARAWAY    eval:html_charset_faraway()
  259. meta HTML_CHARSET_FARAWAY    (__HTML_CHARSET_FARAWAY && __HIGHBITS)
  260. describe HTML_CHARSET_FARAWAY    A foreign language charset used in HTML markup
  261. tflags HTML_CHARSET_FARAWAY    userconf
  262.  
  263. meta HTML_MIME_NO_HTML_TAG    MIME_HTML_ONLY && !__TAG_EXISTS_HTML
  264. describe HTML_MIME_NO_HTML_TAG    HTML-only message, but there is no HTML tag
  265.  
  266. body __HTML_COMMENT_RATIO    eval:html_range('total_comment_ratio','0.70','1.00')
  267. meta HTML_COMMENT_RATIO        __HTML_COMMENT_RATIO && MIME_HTML_ONLY
  268. describe HTML_COMMENT_RATIO    HTML comments are large percentage of message
  269.  
  270. ###########################################################################
  271. # rawbody HTML tests
  272.  
  273. rawbody SPAM_FORM        /CHANGE EMAIL ADDRESS IN ACTION OF FORM/
  274. describe SPAM_FORM        Form for changing email address
  275. rawbody SPAM_FORM_RETURN    /return validate_form/
  276. describe SPAM_FORM_RETURN    Form for checking email address
  277. rawbody SPAM_FORM_ACTION    /action="\&\#\d+;\&\#\d+;\&\#\d+;\&\#\d+;/i
  278. describe SPAM_FORM_ACTION    Obfuscated action attribute in HTML form
  279.  
  280. rawbody HIDE_WIN_STATUS        /<[^>]+onMouseOver=[^>]+window\.status=/i
  281. describe HIDE_WIN_STATUS    Javascript to hide URLs in browser
  282.  
  283. rawbody LINK_TO_NO_SCHEME    /\s+href=['"]?www\./i
  284. describe LINK_TO_NO_SCHEME    Contains link without http:// prefix
  285.  
  286. rawbody __OBFUSCATING_COMMENT_A    /\w(?:<![^>]*>)+\w/
  287. rawbody __OBFUSCATING_COMMENT_B    /[^\s>](?:<![^>]*>)+[^\s<]/
  288. meta OBFUSCATING_COMMENT    ((__OBFUSCATING_COMMENT_A && HTML_MESSAGE) || (__OBFUSCATING_COMMENT_B && MIME_HTML_ONLY))
  289. describe OBFUSCATING_COMMENT    HTML comments which obfuscate text
  290.  
  291.